﻿using System;
using System.Globalization;
using System.Windows.Data;

namespace Ellanet.Converters
{
    public class MillisecondsToSecondsStringConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            double d;

            if ((value != null) && Double.TryParse(value.ToString(), out d))
            {
                return (d/1000).ToString("0.0");
            }

            return "0.0";
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
